import React, { Component } from 'react';
import {View,Platform,Text} from 'react-native';
//全局设置字体样式,将代码放到项目入口文件中
//安卓中字体fontFamily设置为Roboto

//59版本
const defaultFontFamily = {...Platform.select({android:{fontFamily:'Roboto'}})};
const oldRender = Text.render;
Text.render = function(...args){
    const orgin = oldRender.call(this,...args);
    return React.cloneElement(orgin,{style:[defaultFontFamily,orgin.props.style]});
}

//48版本
function fixTextOff(){
    if(Platform.os!='ios'){
        const oldRender=Text.prototype.render
        Text.prototype.render=function render(...args){
            const origin=oldRender.call(this,...args)
            return React.cloneElement(origin,{
                style:[{fontFamily:'Roboto'},origin.props.style]}
            );
        }
    } 
}
